#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#ifndef _NET_H
#define _NET_H

#define LISTEN_QUEUE_SIZE 50

namespace net {

class Socket {
    public:
        Socket(int socket, bool activate = true);
	void connect();
	~Socket();

	int id();
    protected:
        Socket(int socket, sockaddr_in* remote_addr, socklen_t len);
	friend class ServerSocket;
    private:
        int socket;

};

class ServerSocket {
    public:
        ServerSocket(int port, bool activate = true);
	void bind();
	void listen();
	Socket* accept();
	~ServerSocket();
    private:
        int socket_id;
	struct sockaddr_in address;
};

}
#endif
